package cn.wolfcode.enums;

import lombok.Getter;

@Getter
public enum NoticeLevelEnums {
    EMERGENCY("紧急",0),
    IMPORT("重要",1),
    NORMAL("普通",2);

    private String name;
    private Integer value;

    NoticeLevelEnums(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    public static String findName(Integer value){
        //获取所有的示例
        NoticeLevelEnums[] consumptionEnums = values();
        for (NoticeLevelEnums anEnum : consumptionEnums){
            //判断实例中的value是否等于传入的value
            if (anEnum.value.equals(value)){
                return anEnum.name;
            }
        }
        return null;
    }

}
